import os
'''
合并数据
'''
from readexcel import *
if __name__=='__main__':
    file_path_dir = "E:\\2022年数学建模\\数学建模\\2022-mathematical-modeling\\数据集\\基本数据\\附件8、锡林郭勒盟气候2012-2022\\"
    final_path = "E:\\2022年数学建模\\数学建模\\2022-mathematical-modeling\\数据集\\基本数据\\问题二汇总表.xlsx"
    #print(readExcelALL(final_path))
    pddata = readExcelALL(final_path)
    pddata = pddata.iloc[:,[0,1]]
   # print(pddata)
    for i in range(len(pddata)):
        months = pddata.iloc[i,0]
        year = pddata.iloc[i,1]
        file_path = os.path.join(file_path_dir,str(year)+'年.xls')
        if not os.path.exists(file_path):
            print('not find', file_path)
        subdata = readExcelALL(file_path)

        needdata = subdata.iloc[int(months)-1,16]#第20列
        print(needdata)#打印出来复制到exceL 那一列
